package com.hp.servlet;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBUtil {
	 private static final String driver="com.mysql.cj.jdbc.Driver";
     private static final String url="jdbc:mysql://localhost:3306/login?serverTimezone=UTC";
     private static final String username="root";
     private static final String password="root";
     static {
     	try {
     		Class.forName(driver);
     	}catch(ClassNotFoundException e) {
     		 e.printStackTrace();
     	}
     }
    public static Connection getConnection() {
 	   Connection con = null;
 	   try {
 		    con = DriverManager.getConnection(url, username, password);
 	   }catch(SQLException e) {
 		   e.printStackTrace();
 	   }
		return con;
    }
	
}
